package com.easy.yours.biz.model;

import com.easy.system.model.BaseBean;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created with IntelliJ IDEA.
 * User: sunguangzhu
 * Date: 13-7-30
 * Time: 下午9:50
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "t_student", catalog = "commonproject")
public class Student extends BaseBean {
    private String name;
    private java.sql.Date borthDate;
    private Long age;
    private Double height;
    private Clazz clazz;
    public Student() {
    }

    public Student(String name, Date borthDate, Long age, Double height, Clazz clazz) {
        this.name = name;
        this.borthDate = borthDate;
        this.age = age;
        this.height = height;
        this.clazz = clazz;
    }
    @Column
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    @Column
    public Date getBorthDate() {
        return borthDate;
    }

    public void setBorthDate(Date borthDate) {
        this.borthDate = borthDate;
    }
    @Column
    public Long getAge() {
        return age;
    }

    public void setAge(Long age) {
        this.age = age;
    }
    @Column
    public Double getHeight() {
        return height;
    }

    public void setHeight(Double height) {
        this.height = height;
    }

    @ManyToOne(cascade= CascadeType.REFRESH, fetch=FetchType.EAGER)
    @JoinColumn(name="clazz_id")
    @ForeignKey(name="fk_student_clazz")
    public Clazz getClazz() {
        return clazz;
    }

    public void setClazz(Clazz clazz) {
        this.clazz = clazz;
    }
}
